﻿<UserControl x:Class="Vibstudio.NetConfigurator.UI.Views.ResultConfigurationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ac="clr-namespace:Vibstudio.NetConfigurator.UI.Controls;assembly=Vibstudio.NetConfigurator.UI.Controls"
             xmlns:local="clr-namespace:Vibstudio.NetConfigurator.UI"
             IsEnabled="{Binding IsEnabled, UpdateSourceTrigger=PropertyChanged}">

    <ac:AdornedControl Name="LoadingAdorner"
                       IsAdornerVisible="{Binding OperationInProgress, UpdateSourceTrigger=PropertyChanged}">
        <ac:AdornedControl.AdornerContent>
            <local:LoadingWait />
        </ac:AdornedControl.AdornerContent>
        <Grid x:Name="ResultGrid"
              Grid.Column="1"
              Grid.Row="0"
              Margin="3,5,5,3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="50" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="150" />
            </Grid.RowDefinitions>
            <Label Grid.Column="0"
                   Grid.Row="0"
                   Padding="0"
                   HorizontalContentAlignment="Center"
                   VerticalContentAlignment="Center"
                   Content="{Binding Path=Result, Converter={StaticResource ResultConverter}, ConverterParameter=ConfigurationResultMessageContent}"
                   Foreground="{Binding Path=Result, Converter={StaticResource ResultConverter}, ConverterParameter=ResultMessageForeground}" />
            <ListView Grid.Column="0"
                      Grid.Row="1"
                      Margin="10"
                      ItemsSource="{Binding Result, UpdateSourceTrigger=PropertyChanged}">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="{Binding ApplicationColumnName, UpdateSourceTrigger=PropertyChanged}"
                                        DisplayMemberBinding="{Binding Path=Application}" />
                        <GridViewColumn Header="{Binding ConfigurationColumnName, UpdateSourceTrigger=PropertyChanged}"
                                        DisplayMemberBinding="{Binding Path=Configuration}" />
                        <GridViewColumn Header="{Binding OutcomeColumnName, UpdateSourceTrigger=PropertyChanged}"
                                        DisplayMemberBinding="{Binding Path=IsValid}" />
                        <GridViewColumn Header="{Binding MessageColumnName, UpdateSourceTrigger=PropertyChanged}"
                                        DisplayMemberBinding="{Binding Path=Message}" />
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel Grid.Column="1"
                        Grid.Row="1"
                        Margin="0,4">
                <Button Command="{Binding GoToHomeCommand}"
                        Template="{StaticResource GoToHomeButton}"
                        ClickMode="Release"
                        BorderThickness="0"
                        BorderBrush="Transparent"
                        VerticalAlignment="Top">
                    <Button.ToolTip>
                        <ToolTip Content="{Binding GoToHomeToolTip, UpdateSourceTrigger=PropertyChanged}"
                                 Template="{DynamicResource InformationToolTip}" />
                    </Button.ToolTip>
                </Button>
                <Button Command="{Binding ExecuteValidationUrlCommand}"
                        Template="{StaticResource ValidateUrlButton}"
                        ClickMode="Release"
                        BorderThickness="0"
                        BorderBrush="Transparent"
                        VerticalAlignment="Top">
                    <Button.ToolTip>
                        <ToolTip Content="{Binding ValidateUrlToolTip, UpdateSourceTrigger=PropertyChanged}"
                                 Template="{DynamicResource InformationToolTip}" />
                    </Button.ToolTip>
                </Button>
            </StackPanel>
        </Grid>
    </ac:AdornedControl>
</UserControl>